package com.jasonli.dao;

import com.jasonli.domain.ProductType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ProductTypeDao {

    @Insert("insert into product_type (tid, tname) values (null, #{tname})")
    public void save(ProductType type);

    @Delete("delete from product_type where tid = #{tid}")
    public void delete(Integer tid);

    @Update("update product_type set tname = #{tname} where tid = #{tid}")
    public void update(ProductType type);

    @Select("select tid, tname from product_type where tid = #{tid}")
    public ProductType getByTid(Integer tid);

    @Select("select tid, tname from product_type")
    public List<ProductType> getAll();

}
